package com.factory.generic;

public class ConcreteFactory extends AbstractFactory {
    @Override
    protected <T extends IProduct> T createProduct(Class<T> c) {
        IProduct product = null;
        try {
            product = (IProduct) Class.forName(c.getName()).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        return (T) product;
    }
}
